home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / out-of-phase-102-c / OutOfPhase 1.02 Source / OutOfPhase Folder / ASTOperand.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-23  |  2.9 KB  |  96 lines  |  [TEXT/KAHL]

  1. /* ASTOperand.h */
  2.  
  3. #ifndef Included_ASTOperand_h
  4. #define Included_ASTOperand_h
  5.  
  6. /* ASTOperand module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* FixedPoint */
  12. /* TrashTracker */
  13. /* Memory */
  14. /* SymbolTableEntry */
  15. /* PcodeObject */
  16. /* CompilerRoot */
  17.  
  18. #include "PcodeObject.h"
  19. #include "CompilerRoot.h"
  20. #include "FixedPoint.h"
  21.  
  22. struct ASTOperandRec;
  23. typedef struct ASTOperandRec ASTOperandRec;
  24.  
  25. /* all memory allocated from this module is through TrashTracker */
  26.  
  27. /* operand types */
  28. typedef enum
  29.     {
  30.         eASTOperandIntegerLiteral EXECUTE(= -22512),
  31.         eASTOperandBooleanLiteral,
  32.         eASTOperandSingleLiteral,
  33.         eASTOperandDoubleLiteral,
  34.         eASTOperandFixedLiteral,
  35. #if 0
  36.         eASTOperandStringLiteral,
  37. #endif
  38.         eASTOperandSymbol
  39.     } ASTOperandType;
  40.  
  41. /* forwards */
  42. struct TrashTrackRec;
  43. struct SymbolRec;
  44.  
  45. /* create a new integer literal */
  46. ASTOperandRec*        NewIntegerLiteral(struct TrashTrackRec* TrashTracker,
  47.                                         long IntegerLiteralValue, long LineNumber);
  48.  
  49. /* create a new boolean literal */
  50. ASTOperandRec*        NewBooleanLiteral(struct TrashTrackRec* TrashTracker,
  51.                                         MyBoolean BooleanLiteralValue, long LineNumber);
  52.  
  53. /* create a new single precision literal */
  54. ASTOperandRec*        NewSingleLiteral(struct TrashTrackRec* TrashTracker,
  55.                                         float SingleLiteralValue, long LineNumber);
  56.  
  57. /* create a new double precision literal */
  58. ASTOperandRec*        NewDoubleLiteral(struct TrashTrackRec* TrashTracker,
  59.                                         double DoubleLiteralValue, long LineNumber);
  60.  
  61. /* create a new fixed-point literal */
  62. ASTOperandRec*        NewFixedLiteral(struct TrashTrackRec* TrashTracker,
  63.                                         largefixedsigned FixedLiteralValue, long LineNumber);
  64.  
  65. #if 0
  66. /* create a new string literal.  the string should be a valid heap block and is */
  67. /* stored in the structure (i.e. a copy is NOT made) */
  68. ASTOperandRec*        NewStringLiteral(struct TrashTrackRec* TrashTracker,
  69.                                         char* StringLiteralValue, long LineNumber);
  70. #endif
  71.  
  72. /* create a new symbol reference. */
  73. ASTOperandRec*        NewSymbolReference(struct TrashTrackRec* TrashTracker,
  74.                                         struct SymbolRec* SymbolTableEntry, long LineNumber);
  75.  
  76. /* find out if it is a symbol */
  77. MyBoolean                    IsOperandASymbol(ASTOperandRec* Operand);
  78.  
  79. /* get a symbol from the operand */
  80. struct SymbolRec*    GetSymbolFromOperand(ASTOperandRec* Operand);
  81.  
  82. /* type check the operand node.  this returns eCompileNoError if */
  83. /* everything is ok, and the appropriate type in *ResultingDataType. */
  84. CompileErrors            TypeCheckOperand(DataTypes* ResultingDataType,
  85.                                         ASTOperandRec* Operand, long* ErrorLineNumber,
  86.                                         struct TrashTrackRec* TrashTracker);
  87.  
  88. /* find out what kind of operand this is */
  89. ASTOperandType        OperandWhatIsIt(ASTOperandRec* TheOperand);
  90.  
  91. /* generate code for an operand. returns True if successful, or False if it fails. */
  92. MyBoolean                    CodeGenOperand(struct PcodeRec* FuncCode,
  93.                                         long* StackDepthParam, ASTOperandRec* Operand);
  94.  
  95. #endif
  96.